<template>
  <div>{{ num }}</div>
  <div>{{ person.age }}</div>
</template>

<script setup lang="ts" name="Child">
import { ref, reactive } from "vue";
const num = ref(0);

const person = reactive({
  name: "ddd",
  age: 333,
});


const changeAge = () => {
  person.age = 520;
};

// 需要向外导出,父组件才可以获取到
defineExpose({ num, changeAge });
</script>

<style scoped lang="scss"></style>
